package com.huawei.crm.event;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Component;

/**
 * 事件发布者（publisher）事件发生的触发者
 *
 * @author luohua
 */
@Component
public class MyTestEventPubListener {

    @Autowired
    private ApplicationEventPublisher applicationEventPublisher;

    /**
     * 事件发布方法
     */
    public void pushListener(String msg) {
        applicationEventPublisher.publishEvent(new MyTestEvent(this, msg));
    }

    /**
     * 事件发布方法
     */
    public void pushListener2(String msg) {
        applicationEventPublisher.publishEvent(new MyTestEvent("test", msg));
    }

}